home *** CD-ROM | disk | FTP | other *** search
/ Jurassic Jigsaws / JURASSIC.BIN / jigsaw.dir / 00177_Script_Movie Script < prev    next >
Text File  |  1996-09-13  |  6KB  |  174 lines

  1. Global gCurrentPuzzleNum, gLastPuzzleNum, gHowManyRight, gorigLoc, grightAnswerList, gMatchThese, gDragChannel, gOrigSprite, gFlag, gHintChannel, gFirstPieceChan, gLastPieceChan, gHintSprite, gFlyOffChannel, gCurrentModule, gPuzzleList, gHelpModule, gCurrentWIndow, void, filesep
  2.  
  3. On startMovie
  4.   if the machinetype = 256 then 
  5.     set filesep = "\"
  6.   else
  7.     set filesep = ":"
  8.   end if
  9.   
  10.   set gCurrentWIndow = void
  11.   set gHelpModule = #Jigsaw
  12.   --  repeat with x = 1 to 48
  13.   --    puppetSprite x, true
  14.   --  end repeat
  15.   set gFlyOffChannel = 45
  16.   set gDragChannel = 46
  17.   set gFirstPieceChan = 4
  18.   set gLastPieceChan = 15
  19.   set gHintChannel = 3
  20.   set gHintSprite = 18
  21.   set gLastPuzzleNum = 0
  22.   set gCurrentPuzzleNum = 1
  23.   set gMatchThese = [1,1,1,1,1,1,1,1,1,1,1,1]
  24.   set gPuzzleList = [1,2,3,4,5,6,7,8,9]
  25.   
  26. end startMovie
  27.  
  28. on stopmovielocal
  29.   
  30. end stopmovielocal
  31. --------------------------------
  32. on SetUpNextPuzzle
  33.   cursor 4
  34.   set the memberNum of sprite 1 = the number of member "background"
  35.   set the locH of sprite gDragChannel = 1500
  36.   set the locH of sprite gFlyOffChannel = 1500
  37.   set grightAnswerList = [0,0,0,0,0,0,0,0,0,0,0,0]
  38.   -- get a new random puzzle, not the same as the last one
  39.   if count(gPuzzleList) = 0 then set gPuzzleList = [1,2,3,4,5,6,7,8,9]
  40.   put random(count(gPuzzleList)) into tWhereInList
  41.   put getAt(gPuzzleList, tWhereInList) into gCurrentPuzzleNum
  42.   deleteAt (gPuzzleList, tWhereInList)
  43.   --  repeat while gCurrentPuzzleNum = gLastPuzzleNum
  44.   --    set gCurrentPuzzleNum = random (9)
  45.   --  end repeat
  46.   set gLastPuzzleNum = gCurrentPuzzleNum
  47.   set the memberNum of sprite gHintChannel = member ("hint" && gCurrentPuzzleNum)
  48.   --  Find the right puzzle pieces and scatter them
  49.   repeat with x = gFirstPieceChan to gLastPieceChan
  50.     set the locH of sprite x = 300
  51.     set the locV of sprite x = 300
  52.     set nextPiece = (x - 3)
  53.     set the memberNum of sprite x = member (gCurrentPuzzleNum &":"& nextPiece)
  54.     put ((the height of sprite x) / 2) into AdjustVert
  55.     put ((the width of sprite x) / 2) into AdjustHorz
  56.     repeat while the locH of sprite x > (135 - AdjustHorz) and ¼
  57.                  the locH of sprite x < (520 + AdjustHorz) and ¼
  58.                  the locV of sprite x < (425 + AdjustVert)
  59.       set the locV of sprite x = random (480 - AdjustVert)
  60.       set the locH of sprite x = random (640 - adjustHorz)
  61.     end repeat
  62.     if the locV of sprite x < 140 then set the locV of sprite x = the locV of sprite x + 140
  63.     if the locH of sprite x < 30 then set the locH of sprite x = the locH of sprite x + 560
  64.   end repeat
  65.   puppetSound "splat"
  66.   cursor 0
  67.   updateStage
  68. end SetUpNextPuzzle
  69. --------------------------------
  70. on checkLocation
  71.   set PieceNum = gOrigSprite - 3
  72.   -- if the puzzle piece is inside the correct rectangle
  73.   if inside ( (the loc of Sprite gDragChannel), (value(line PieceNum of field ("targetRects"         & gCurrentPuzzleNum)))) then
  74.     -- if there's already a piece there, get it out of the way
  75.     -- check for each possible puzzle piece
  76.     
  77.     repeat with x = 4 to 15
  78.       if sprite gDragChannel intersects x and getAt(grightAnswerList, (x-3)) = 0 then
  79.         if x = gorigSprite then nothing
  80.         else
  81.           set the memberNum of sprite gFlyOffChannel = ¼
  82.                                    the number of member (the memberNum of sprite x)
  83.           set the loc of sprite gFlyOffChannel = the loc of sprite x
  84.           set the locH of sprite x = 1500
  85.           updateStage
  86.           
  87.           repeat with L = 20 down to 1
  88.             set the locH of sprite gFlyOffChannel = ¼
  89.                                    (the locH of sprite gFlyOffChannel) ¼
  90.                                    + (580 - (the locH of Sprite gFlyOffChannel))/L
  91.             updatestage
  92.           end repeat
  93.           
  94.           set the loc of sprite x = the loc of sprite gFlyOffChannel
  95.           set the locH of sprite gFlyOffChannel = 1500
  96.           --          set the locH of sprite gDragChannel = 1500
  97.           updateStage
  98.         end if
  99.       end if
  100.     end repeat
  101.     
  102.     set the locH of sprite gDragChannel = 1500
  103.     set the loc of sprite gOrigSprite = value(line PieceNum of field ("targetPoints" & gCurrentPuzzleNum))
  104.     -- change the list of rightAnswers to reflect that this position is properly placed
  105.     setAt (grightAnswerList, PieceNum, 1)
  106.     -- do colorchange and sound
  107.     updateStage
  108.     DoItsAMatch
  109.   else
  110.     -- check to see if the piece if behind the hint image
  111.     --    if sprite gDragChannel intersects 16 then 
  112.     --      --alert "you have put a piece behind the hint image you will never see it again! Ha ha ha!!"
  113.     --      repeat while sprite gDragChannel intersects 16
  114.     --        put the locH of sprite gDragChannel into spritelocH
  115.     --        set the locH of sprite gDragChannel = spritelocH + 10
  116.     --        updatestage
  117.     --      end repeat
  118.     --    end if
  119.     
  120.     --    in case the user moves a correct piece out of its spot, reset the answerList
  121.     
  122.     setAt (grightAnswerList, PieceNum, 0)
  123.   end if
  124.   
  125.   -- if they're all right
  126.   if grightAnswerList = gMatchThese then
  127.     repeat while soundbusy (1) or soundbusy (2)
  128.       nothing
  129.     end repeat
  130.     DoHappyRightThing
  131.   end if
  132.   updateStage
  133. end checkLocation
  134. --------------------------------
  135.  
  136. On DoItsAMatch
  137.   set the foreColor of Sprite gOrigSprite to 175
  138.   puppetSound "crunch"
  139.   updateStage
  140.   StartTimer
  141.   repeat while the timer < 20
  142.     nothing
  143.   end repeat
  144.   set the foreColor of sprite gOrigSprite to 255
  145.   updateStage
  146. end DoItsAMatch
  147. --------------------------------
  148. On DoHappyRightThing
  149.   repeat with x = 2 to 48
  150.     puppetSprite x, false
  151.   end repeat
  152.   set the memberNum of sprite 1 = the number of member ("fullscreen" && gcurrentPuzzleNum)
  153.   puppetSound 7, member 295
  154.   --updateStage
  155.   puppetSound "magical"
  156.   --updateStage
  157.   set randomSound to (296 + random(4))
  158.   puppetSound 8, member randomSound
  159.   go "fullscreen"
  160. end DoHappyRightThing
  161.  
  162. on killsounds
  163.   sound close 1
  164.   sound close 2
  165.   when mousedown then nothing
  166. end killsounds
  167.  
  168. on playsoundeffect whatfolder, whatsound
  169.   sound playfile 1, the pathname & whatfolder & filesep & whatsound
  170. end playsoundeffect
  171.  
  172. on playvoiceover whatfolder, whatsound
  173.   sound playfile 2, the pathname & whatfolder & filesep & whatsound
  174. end playvoiceover